
<?
$per_page = 10;
$page_no = $p-1<=0 ? 0 : $p-1;
$first = ($page_no) * $per_page;
$limit = $first . ',' . $per_page;
$list_news = getArray('xteam_content','status=1 AND parent_id='.$id,$limit);
if($list_news){
    $total = count(getArray('xteam_content','parent_id='.$id));
    foreach ($list_news as $ListNew){?>
    <div class="page-item">
        <div class="page-item-content"> 
            <a href="<?=$curHost.utf8_to_ascii($newscatali[$itemnews['parent_id']]!=''?$newscatali[$itemnews['parent_id']]:$newscatname[$itemnews['parent_id']])?>/<?=utf8_to_ascii($ListNew['seo_key']!=''?$ListNew['seo_key']:$ListNew['name'])?>/3/<?=$ListNew['id']?>.html">
                <? if($ListNew['image_thumbs']){?>
                <img src="<?=$curHost.$ListNew['image_thumbs']?>" alt="<?=$ListNew['seo_key'].'-'.$ListNew['seo_key']!=''?$ListNew['seo_key']:$ListNew['name']?>" class="postimg wp-post-image">
                <? }else{?>
                <img src="<?=$curHost?>images/no_image.gif" alt="<?=$ListNew['seo_key']." - ".$ListNew["name"]?>"  class="postimg wp-post-image" style="display: inline;" title="<?=$ListNew['seo_key']!=''?$ListNew['seo_key']:$ListNew['name']?>" />
                <? }?>
            </a>
                    
            <h3 class="page-item-title">
                <a title="<?=$itemnews['name']?>" rel="bookmark" href="<?=$curHost.utf8_to_ascii($newscatali[$itemnews['parent_id']]!=''?$newscatali[$itemnews['parent_id']]:$newscatname[$itemnews['parent_id']])?>/<?=utf8_to_ascii($ListNew['seo_key']!=''?$ListNew['seo_key']:$ListNew['name'])?>/3/<?=$ListNew['id']?>.html">
                    <?=$ListNew['seo_key']!=''?$ListNew['seo_key']:$ListNew['name']?>
                </a>
            </h3>
            <p>
                <?=html_entity_decode(catchu(strip_tags($ListNew['detail_short']),500), ENT_QUOTES, 'UTF-8');?>
            </p>
        </div>
    </div>
   
    <? }
    if($_lang=="vn"){
        $rowPage 	= "Tin";
        $pagePage 	= "Trang";
        $titleFirst 	= "&laquo;";
        $titlePrevious 	= "&lsaquo;";
        $titleNext 	= "&rsaquo;";
        $titleLast 	= "&raquo;";
    }else if($_lang=="en"){
        $rowPage = "News";
        $pagePage 	= "Page";
        $titleFirst 	= "First";
        $titlePrevious 	= "Previous";
        $titleNext 	= "Next";
        $titleLast 	= "Last";
    }else{
        $rowPage = "新聞";
        $pagePage 	= "頁";
        $titleFirst 	= "首先";
        $titlePrevious 	= "上一頁";
        $titleNext 	= "下一頁";
        $titleLast 	= "最後";
    }
    $pages_no = countPages($total,$per_page);
    if($total>$per_page || $page_no>0){?>
        <div class="pagging">
            <ul class="page-numbers">
            <? if($p!='' && $p>1){?>
                <? //if(){?>
                <li><a title="<?=$titleFirst?>" id="first" href="<?=$curHost.utf8_to_ascii($_GET['cat'])?>/<?=utf8_to_ascii($_REQUEST['ali'])?>/6/<?=$id?>/page-1.html"><?=$titleFirst?></a></li>
                <li><a title="<?=$titlePrevious?>" id="previous" href="<?=$curHost.utf8_to_ascii($_GET['cat'])?>/<?=utf8_to_ascii($_REQUEST['ali'])?>/6/<?=$id?>/page-<? if($p-1<0){echo $p=1;}else{echo $p-1;}?>.html"><?=$titlePrevious?></a></li>
                <? //}?>
            <? }?>
            <? $from=($p-10>0?$p-10:0); $to=($p+10<$pages_no?$p+10:$pages_no);
            for ($i=$from;$i<$to;$i++){
                if ($i+1!=$p && $i+1>0) {?>
                <li><a class="page-numbers" href="<?=$curHost.utf8_to_ascii($_GET['cat'])?>/<?=utf8_to_ascii($_REQUEST['ali'])?>/6/<?=$id?>/page-<?=$i+1?>.html"><?=$i+1?></a></li>
            <? }else{?>
                <li><a class="active"><span class="page-numbers current"><?=($i+1)?></span></a></li>
            <? }
            }?>
            <? if($pages_no>0 && $p<$pages_no){?>

                <li><a title="<?=$titleNext?>" id="next" href="<?=$curHost.utf8_to_ascii($_GET['cat'])?>/<?=utf8_to_ascii($_REQUEST['ali'])?>/6/<?=$id?>/page-<? if($p+1>$pages_no){echo $p=$pages_no;}else{if($p==''){echo $p+2;}else{echo $p+1;}}?>.html"><?=$titleNext?></a></li>
                <li><a title="<?=$titleLast?>" id="last" href="<?=$curHost.utf8_to_ascii($_GET['cat'])?>/<?=utf8_to_ascii($_REQUEST['ali'])?>/6/<?=$id?>/page-<? if($p+1>$pages_no){echo $p=$pages_no;}else{echo $pages_no;}?>.html"><?=$titleLast?></a></li>
            <? }?>
            </ul>
        </div>
    <? }?>
        <div class="cleared"></div>
<?
}else{
    require_once 'modules/error.php';
}?>